
package com.hex.ds.code.detection.config.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hex.ds.code.detection.config.dao.RolesGitMapper;
import com.hex.ds.code.detection.config.model.RolesGit;
import com.hex.ds.code.detection.config.service.RolesGitService;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Package com.hex.ds.code.detection.script.config.service.impl
 * @ClassName RolesGitServiceImpl
 * @Description 权限与git中间表
 * @Author le.zhang
 * @Date 2024/3/4 13:14
 * @Version v1.0
 **/
@Service
public class RolesGitServiceImpl extends ServiceImpl<RolesGitMapper, RolesGit> implements
    RolesGitService {

    /**
     * @Method queryList
     * @Param page
     * @Param rolesGit
     * @Return com.baomidou.mybatisplus.extension.plugins.pagination.Page
     * @Description 分页查询
     * @Author le.zhang
     * @Date 2024/3/4 13:14
     * @Version V1.0
     */
    @Override
    public Page queryList(Page page, RolesGit rolesGit) {
        LambdaQueryWrapper<RolesGit> wrapper = Wrappers.lambdaQuery();
        Page returnPage = this.baseMapper.selectPage(page, wrapper);
        return returnPage;
    }

    /**
     * @Method queryListNoPage
     * @Param id
     * @Return java.util.List<com.hex.ds.code.detection.script.config.model.RolesGit>
     * @Description 不分页查询，通过RoleId精确查
     * @Author le.zhang
     * @Date 2024/3/4 13:14
     * @Version V1.0
     */
    @Override
    public List<RolesGit> queryListNoPage(String id) {
        LambdaQueryWrapper<RolesGit> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(StrUtil.isNotBlank(id),RolesGit::getRoleId,id);
        List<RolesGit> rolesGits = this.baseMapper.selectList(wrapper);
        return rolesGits;
    }
}
